home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
COMMUNIC
/
H191.ZIP
/
CA29-3.EXE
/
PC-2-PC.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1992-11-30
|
23KB
|
1,501 lines
S29="ATE0Q0V1X1S0=2 S7=30 S9=10^M"
S19="PC-2-PC ver 1.1 "
LEGE S19
SUBD S18
DLDI S17
SET DLDI " "
SET FLAG(0) OFF
SET FLAG(1) ON
SET FLAG(2) Off
SET FLAG(3) Off
SET CDIS ON
SET RDIS OFF
SET SOFT OFF
SET ATIM 0
SET ALAR OFF
SET CHAT OFF
SET XSUI 10
ON ESCA GOSU Exit
N90=N91=N92=0
S16=""
S15=""
SET PARI NONE
SET DATA 8
SET STOP 1
N98=0
GOSU InitScre
GOSU BuildLoc
IF ZERO N98
GOSU LinkTest
ELSE
FOPENI "PC2PC.LOC" TEXT
ENDI
Main:
LEGE S19
LOCA (N99-3),77
SOUN 440,100
SET TTHR OFF
Main100:
IF HITKEY
GOTO MAIN200
ENDI
IF RECEIVE
GOTO MAIN300
ENDI
IF ZERO N98 AND NOT CONNECTED
GOTO Exit
ENDI
GOTO Main100
MAIN200:
KEYG S1
SWIT S1
CASE "C"
GOSU ChangeOu
ENDC
CASE "E"
GOTO Exit
ENDC
CASE "H"
GOSU Help
ENDC
CASE "S"
GOSU Select
ENDC
CASE "T"
GOSU Transfer
ENDC
CASE "W"
GOSU Wildcard
ENDC
CASE "4D00"
GOSU Change_S
ENDC
CASE "4B00"
GOSU Change_S
ENDC
CASE "4900"
GOSU Prev_Pag
ENDC
CASE "5100"
GOSU Next_Pag
ENDC
CASE "4700"
GOSU Home_Pag
ENDC
CASE "4F00"
GOSU End_Page
ENDC
CASE "4800"
GOSU Cursor_U
ENDC
CASE "5000"
GOSU Cursor_D
ENDC
CASE "7100"
SHEL
ENDC
DEFA
SOUN 100,100
ENDC
ENDS
GOTO Main
MAIN300:
RGET S1 1
SWIT S1
CASE "R"
RGET S1 80 10
TRAN "+!"
GOSU Remote_C
ENDC
CASE "E"
GOTO Exit
ENDC
CASE "L"
RGET S1 80 10
TRAN "+!"
GOSU Local_Ch
ENDC
CASE "T"
RGET S1 80 10
GOSU Rcv_Tran
ENDC
CASE "W"
RGET S1 80 10
GOSU Rcv_Wild
ENDC
CASE "?"
TRAN "PC-2-PC!"
SET FLAG(1) OFF
GOSU Exchange
ENDC
DEFA
RFLU
GOTO Main100
ENDC
ENDS
GOTO Main
Exit:
IF FLAG (0)
TRAN "E!"
SET FLAG(0) OFF
ENDI
TSIN (9) N9,N8,N7
S3="DISCONNECT: ("&N9&":"&N8&":"&N7&")"
CLOG S3
IF CONNECTED and NOT FLAG(3)
HANG
ENDI
DO
REST
UNTI FAILURE
FCLOSEI
FCLOSEO
DELE "PC2PC.LOC"
DELE "PC2PC.REM"
CHDI S18
SET CDRE ON
BYE
Clear_Cu:
IF NOT ZERO N90
GOSU Read_Cur
IF FLAG(2)
ATSA N90,41 (default) S12
ELSE
ATSA N90,2 (default) S12
ENDI
ENDI
RETU
Set_Curs:
GOSU Read_Cur
IF NOT ZERO N90
IF FLAG(2)
IF NOT NULL S12
ATSA N90,41 (contrast) S12
ELSE
N90=N90-1
GOTO Set_Curs
ENDI
ELSE
IF NOT NULL S12
ATSA N90,2 (contrast) S12
ELSE
N90=N90-1
GOTO Set_Curs
ENDI
ENDI
ENDI
RETU
Read_Cur:
S12=""
IF NOT ZERO N90
IF FLAG(2)
ATSC N90,41,37 S12
ELSE
ATSC N90,2,37 S12
ENDI
ENDI
RETU
Cursor_U:
GOSU Clear_Cu
IF NOT ZERO N90
N90=N90-1
ELSE
N90=N99-5
ENDI
GOSU Set_Curs
RETU
Cursor_D:
GOSU Clear_Cu
IF LT N90 (N99-5)
N90=N90+1
ELSE
N90=1
ENDI
GOSU Set_Curs
RETU
Change_S:
GOSU Clear_Cu
N90=0
IF FLAG(2)
ATSA N99-4,9 (default) " , , PgUp, PgDn "
ATSA N99-4,48 (default) " to this window "
SET FLAG(2) OFF
FOPENI "PC2PC.LOC" TEXT
ELSE
ATSA N99-4,9 (default) " to this window "
ATSA N99-4,48 (default) " , , PgUp, PgDn "
SET FLAG(2) ON
FOPENI "PC2PC.REM" TEXT
ENDI
RETU
Clear_Wi:
IF FLAG(2)
SCRO 0,1,40,(N99-5),77 (default)
ELSE
SCRO 0,1,1,(N99-5),38 (default)
ENDI
N90=0
RETU
Prev_Pag:
FRESTOREI
IF FAILURE
RETU
ENDI
FRESTOREI
IF FAILED
SOUN 100,100
ENDI
FSAVEI
GOSU Clear_Wi
PRPA100:
N1=1
PRPA200:
READ S1 40 N0
IF EOF
IF EQ N1 1
GOTO Prev_Pag
ENDI
GOTO PRPAXIT
ENDI
IF FLAG(2)
ATSA N1,41 (default) S1(0:35)
ELSE
ATSA N1,2 (Default) S1(0:35)
ENDI
INC N1
IF LE N1 (N99-5)
GOTO PRPA200
ENDI
PRPAXIT:
RETU
Next_Pag:
FSAVEI
GOSU Clear_Wi
GOTO PRPA100
Home_Pag:
REWI
FSAVEI CLEAR
GOTO Next_Pag
End_Page:
FSAVEI
GOSU Clear_Wi
ENPA100:
N1=1
ENPA200:
READ S1 40 N0
IF EOF
IF EQ N1 1
FRESTOREI
IF FAILURE
RETU
ENDI
ENDI
GOTO ENPAXIT
ENDI
INC N1
IF LE N1 (N99-5)
GOTO ENPA200
ENDI
FSAVEI
IF FAILED
FSAVEI SHIFT
FSAVEI
ENDI
GOTO ENPA100
ENPAXIT:
FSAVEI
IF FAILED
FSAVEI SHIFT
FSAVEI
ENDI
GOTO PRev_Pag
ChangeOu:
IF FLAG(2)
IF NOT ZERO N92
GOTO CHDI200
ENDI
ELSE
IF NOT ZERO N91
GOTO CHDI100
ENDI
ENDI
IF FLAG(2)
S11="PC2PC.REM"
ELSE
S11="PC2PC.LOC"
ENDI
FFIR S11
FNEX S11 QUAL
GOSU Ask_Dir
IF FLAG(9)
RETU
ENDI
FCLOSEI
DELE S11
GOSU Clear_Wi
IF FLAG(2)
GOSU BuildRem
ELSE
GOSU SendLocD
ENDI
IF FLAG(2)
S11="PC2PC.REM"
ELSE
S11="PC2PC.LOC"
ENDI
FOPENI S11 TEXT
RETU
CHDI100:
S10="_ONESCAPE"
ON ESCA GOSU CHDIEsc
SAVE 10,10,12,70
BOX 10,10,12,70 (contrast)
CHDI110:
ATSA 11,12 (contrast) "Files are selected on local side: Delete? Y/N: "
ATSA 12,26 (contrast) " Press ESC to cancel "
KEYG S1
ON ESCA GOSU S10
REST
SWIT S1
CASE "N"
RETU
ENDC
CASE "Y"
S16=""
N91=0
GOTO ChangeOu
ENDC
DEFA
SOUN 100,100
GOTO CHDI100
ENDC
ENDS
CHDI200:
S10="_ONESCAPE"
ON ESCA GOSU CHDIEsc
SAVE 10,10,12,70
BOX 10,10,12,70 (contrast)
ATSA 11,12 (contrast) "Files are selected on remote side: Delete? Y/N: "
ATSA 12,26 (contrast) " Press ESC to cancel "
KEYG S1
ON ESCA GOSU S10
REST
SWIT S1
CASE "N"
RETU
ENDC
CASE "Y"
S15=""
N92=0
GOTO ChangeOu
ENDC
DEFA
SOUN 100,100
GOTO CHDI200
ENDC
ENDS
CHDIEsc:
S1=""
RETU
Disc_Err:
BOX 10,10,12,70 (contrast)
ATSA 11,12 (contrast) "Fatal disk error - PC2PC terminating"
ATSA 12,26 (contrast) " Press any key to continue "
KEYG S0
GOTO Exit
Unimpl:
S10="_ONESCAPE"
ON ESCA GOSU UnimEsc
SAVE 10,10,12,70
BOX 10,10,12,70 (contrast)
ATSA 11,12 (contrast) "Unimplemented function"
ATSA 12,26 (contrast) " Press any key to continue "
KEYG S1
ON ESCA GOSU S10
REST
RETU
UnimEsc:
RETU
BuildLoc:
FOPENO "PC2PC.LOC" TEXT
IF FAILURE
GOSU Disc_Err
ENDI
FFIR "*.*"
IF Failure
FCLOSEO
RETU
ENDI
N1=1
BULD100:
FNEX S1
IF Failure
FCLOSEO
RETU
ENDI
IF STRCMP S1 "PC2PC.LOC"
GOTO BULD100
ENDI
IF STRCMP S1 "PC2PC.REM"
GOTO BULD100
ENDI
IF STRCMP S1(1:1) "."
GOTO BULD100
ENDI
FATT S2 S1
IF STRCMP S2(3:3) "1"
GOTO BULD100
ENDI
FSIZ S2 S1
FDAT S3 S1
FTIM S4 S1
S1(13:79)=S2
S1(21:79)=S3
S1(31:79)=S4
S1(36)=" "
S1(37)=" "
S1(38)=" "
S1(39)=" "
S1(40)=" "
PRES S1
IF GE (N99-5),N1
ATSA N1,2 (default) S1(0:36)
ENDI
WRIT S1 40
WRIT "^M" 2
INC N1
GOTO BULD100
LinkTest:
IF NOT CONNECTED
GOTO NoLink
ENDI
LEGE " Testing for link"
RFLU
TRAN "!?!"
RGET S1 80 10
IF FAILURE
GOTO NoLink
ENDI
IF NOT STRCMP S1 "PC-2-PC"
GOTO NoLink
ENDI
GOSU Exchange
IF NOT FLAG(0)
GOTO NoLink
ENDI
LinkXIT:
S19(20:79)="Linked"
RETU
NoLink:
RFLU
LEGE " Select link method"
SET FLAG(0) OFF
SAVE 8,10,21,70
BOX 8,10,21,70 (contrast)
ATSA 9,12 (contrast) "No link is detected: select one of the following:"
ATSA 11,12 (contrast) "1) Direct connect "
ATSA 12,12 (contrast) "2) Wait for direct connect"
ATSA 14,12 (contrast) "3) Dial the remote PC"
ATSA 15,12 (contrast) "4) Wait for call connect "
ATSA 17,12 (contrast) "5) Change subdirectory "
ATSA 18,12 (contrast) "6) Help"
ATSA 20,12 (Contrast) "Select: "
ATSA 21,28 (Contrast) " ESC terminates script "
NOLI100:
LOCA 20,21
KEYG S1
SWIT S1
CASE "1"
GOSU Direct
IF not FLAG(9)
GOTO NOLI100
ENDI
COMP S3
S2="CONNECT: Direct Connect "*S3*" PC-TO-PC"
CLOG S2
SET TIME (9)
SET FLAG(3) ON
REST
ENDC
CASE "2"
GOSU Await_Di
IF not FLAG(9)
GOTO NOLI100
ENDI
GOSU Respond
IF FLAG(1)
SOUN 880,500
GOTO NOLI100
ENDI
REST
GOSU Exchange
IF FLAG(0)
COMP S3
S2="CONNECT: Direct Connect "*S3*" PC-TO-PC"
CLOG S2
SET FLAG(3) ON
GOTO LinkXIT
ENDI
ENDC
CASE "3"
GOSU Dial
IF FLAG(9)
GOTO NOLI100
ENDI
CLOG "* PC-2-PC Dial done"
REST
ENDC
CASE "4"
GOSU Await_Ca
IF FLAG(9)
GOTO NOLI100
ENDI
GOSU Respond
IF FLAG(1)
SOUN 880,500
GOTO NOLI100
ENDI
REST
GOSU Exchange
IF FLAG(0)
CLOG "* PC-2-PC Dial auto-answer"
GOTO LinkXIT
ENDI
ENDC
CASE "5"
FFIR "PC2PC.LOC"
FNEX S11 QUAL
GOSU Change_D
IF FLAG(9)
GOTO NOLI100
ENDI
FCLOSEI
DELE S11
REST
SCRO 0,1,1,(N99-5),38 (default)
GOSU BuildLoc
FOPENI "PC2PC.LOC" TEXT
GOTO NoLink
ENDC
CASE "6"
GOSU Help
GOTO NOLI100
ENDC
DEFA
SOUN 100,100
GOTO NOLI100
ENDC
ENDS
GOTO LinkTest
Direct:
SET CDRE OFF
GOSU Set_Parm
RFLU
RETU
Await_Di:
SET CDRE OFF
GOSU Set_Parm
RFLU
RETU
Set_parm:
WOPE 8,10,15,70 (Contrast) SEPAESC
SET FLAG(9) ON
ATSA 8,12 (contrast) " Direct connection - set parameters"
ATSA 9,12 (contrast) "Select any of the following, CR to begin:"
ATSA 10,12 (contrast) "A) COM1"
ATSA 11,12 (contrast) "B) COM2"
ATSA 12,12 (contrast) "C) COM3"
ATSA 13,12 (contrast) "D) COM4"
ATSA 10,22 (contrast) "1) 300"
ATSA 11,22 (contrast) "2) 1200"
ATSA 12,22 (contrast) "3) 2400"
ATSA 13,22 (contrast) "4) 4800"
ATSA 10,32 (contrast) "5) 9600"
ATSA 11,32 (contrast) "6) 14.4k"
ATSA 12,32 (contrast) "7) 19.2k"
ATSA 13,32 (contrast) "8) 38.4k"
ATSA 10,42 (contrast) "9) 57.6k"
ATSA 11,42 (contrast) "0) 115k"
ATSA 12,42 (contrast) "Note: 115k may yield"
ATSA 13,42 (contrast) "a high error rate..."
ATSA 14,12 (contrast) "Current setting: "
ATSA 15,29 (contrast) " Press ESC to cancel "
SEPA100:
COMP S1
ATSA 14,29 (CONTRAST) S1(0:14)
KEYG S1
SWIT S1
CASE "0D"
WCLO
RETU
ENDC
CASE "A"
SET PORT COM1
ENDC
CASE "B"
SET PORT COM2
ENDC
CASE "C"
SET PORT COM3
ENDC
CASE "D"
SET PORT COM4
ENDC
CASE "1"
SET BAUD 300
ENDC
CASE "2"
SET BAUD 1200
ENDC
CASE "3"
SET BAUD 2400
ENDC
CASE "4"
SET BAUD 4800
ENDC
CASE "5"
SET BAUD 9600
ENDC
CASE "6"
SET BAUD 14k
ENDC
CASE "7"
SET BAUD 19K
ENDC
CASE "8"
SET BAUD 38K
ENDC
CASE "9"
SET BAUD 57K
ENDC
CASE "0"
SET BAUD 115K
ENDC
DEFA
SOUN 100,100
ENDC
ENDS
GOTO SEPA100
SEPAEsc:
S1="0D"
SET FLAG(9) OFF
RETU
Dial:
S10="_ONESCAPE"
ON ESCA GOSU DialEsc
LEGE " Dialing remote PC"
SAVE 10,10,12,70
BOX 10,10,12,70 (contrast)
ATSA 11,12 (contrast) "Enter number to be dialed: "
ATSA 12,29 (contrast) " Press ESC to cancel "
Dial100:
SET FLAG (9) ON
ATGE 11,39 (contrast) 4 S1
IF NULL S1
GOTO DialXIT
ENDI
DIAL S1
IF FAILED
SOUN 880,500
GOTO Dial100
ENDI
CLOG "* PC-2-PC Dialed: "*"_call"
SET FLAG (9) OFF
DialXIT:
ON ESCA GOSU S10
REST
RETU
DialEsc:
S1=""
RETU
Await_Ca:
S10="_ONESCAPE"
ON ESCA GOSU AWCAEsc
LEGE " Waiting for call"
SAVE 10,10,12,70
BOX 10,10,12,70 (contrast)
ATSA 11,12 (contrast) "Waiting for call from remote"
ATSA 12,26 (contrast) " Press ESC to terminate "
SET PARI NONE
SET DATA 8
SET MASK ON
SET FLAG(9) OFF
AWCA100:
Paus 3
HANG
PAUS 3
TRAN S29
AWCA200:
RGET S1 80 180
IF NOT SUCCESS
GOTO AWCAXIT
ENDI
FIND S1 "NO CARRIER"
IF FOUND
GOTO AWCA100
ENDI
FIND S1 "CONNECT"
IF NOT FOUND
GOTO AWCA200
ENDI
IF FIND S1 "1200"
SET BAUD 1200
GOTO AWCAXIT
ENDI
IF FIND S1 "2400"
SET BAUD 2400
GOTO AWCAXIT
ENDI
IF FIND S1 "4800"
SET BAUD 4800
GOTO AWCAXIT
ENDI
IF FIND S1 "9600"
SET BAUD 9600
GOTO AWCAXIT
ENDI
IF FIND S1 "14400" or FIND S9 "14.4"
SET BAUD 14k
GOTO AWCAXIT
ENDI
IF FIND S1 "19200" or FIND S9 "19.2"
SET BAUD 19k
GOTO AWCAXIT
ENDI
IF FIND S1 "38400" or FIND S9 "38.4"
SET BAUD 38k
GOTO AWCAXIT
ENDI
IF FIND S1 "57600" or FIND S9 "57.6"
SET BAUD 57k
GOTO AWCAXIT
ENDI
SET BAUD 300
AWCAXIT:
ON ESCA GOSU S10
REST
RETU
AWCAEsc:
SET FLAG(9) ON
RETU
Change_D:
GOSU Ask_Dir
IF NOT FLAG(9)
CHDI S1
ENDI
RETU
Ask_Dir:
S10="_ONESCAPE"
ON ESCA GOSU ASDIEsc
SAVE 10,1,12,77
BOX 10,1,12,77 (contrast)
ATSA 11,3 (contrast) "Enter new subdirectory: "
ATSA 12,28 (contrast) " Press ESC to cancel "
ASDI100:
SET FLAG (9) ON
ATGE 11,27 (contrast) 50 S1
IF NOT NULL S1
SET FLAG (9) OFF
ENDI
ON ESCA GOSU S10
REST
RETU
ASDIEsc:
S1=""
RETU
Respond:
LEGE " Waiting for prompt"
S10="_ONESCAPE"
ON ESCA GOSU RESPEsc
SAVE 10,10,12,70
BOX 10,10,12,70 (contrast)
ATSA 11,12 (contrast) "Waiting for prompt from remote"
ATSA 12,26 (contrast) " Press ESC to cancel "
RESP100:
RGET S1 80,120
IF SUCCESS and NULL S1
GOTO Resp100
ENDI
IF SUCCESS and STRCMP S1(0:0) "?"
TRAN "PC-2-PC!"
SET FLAG(1) OFF
ENDI
ON ESCA GOSU S10
REST
LEGE S19
RETU
RESPEsc:
S1="ESCAPE"
RETU
Exchange:
FOPENO "PC2PC.REM" TEXT
IF FAILURE
GOSU Disc_Err
ENDI
FOPENI "PC2PC.LOC" TEXT
IF FAILURE
GOSU Disc_Err
ENDI
LEGE "Exchanging directory listings"
N1=1
N5=0
IF FLAG(1)
GOTO EXCH200
ENDI
EXCH100:
RGET S2 80 15
PRES S2
IF Failure
GOTO EXCHXIT
ENDI
IF NOT STRCMP S2(0:0) "+"
INC N5
IF GT N5,20
GOTO EXCHXIT
ENDI
GOTO EXCH210
ENDI
LENG S2 N3
IF GT N3 1
CRC S2(1:40) N2
ATOI S2(41:46) N4
IF NE N2 N4
GOTO EXCHERR
ENDI
ELSE
IF EOF
TRAN "+!"
SET FLAG(0) ON
GOTO EXCHXIT
ENDI
LEGE S19(0:19)&" Line "*N1&" exchanged"
INC N1
GOTO EXCH200
ENDI
IF GE (N99-5),N1
ATSA N1,41 (default) S2(1:37)
ELSE
IF EQ (N99-4) N1
FSAVEI
ENDI
LEGE S19(0:19)&" Line "*N1&" exchanged"
ENDI
WRIT S2(1:40) 40
WRIT "^M" 2
INC N1
EXCH200:
N5=0
READ S3 80 N2
PRES S3
S1=S3
IF EOF
S1="!"
GOTO EXCH210
ENDI
CRC S1(0:39) N2
S1(40:50)=N2&"!"
EXCH210:
TRAN "+"&S1
GOTO EXCH100
EXCHERR:
INC N5
IF GT N5,20
GOTO EXCHXIT
ENDI
TRAN "-!"
LEGE "Exchange Error NAK"
GOTO EXCH100
EXCHXIT:
REWI
FCLOSEO
LEGE S19
RETU
BuildRem:
TRAN "R"&S1&"!"
RGET S1 80 20
PRES S1
IF FAILURE
SOUN 100,100
GOTO BURDXIT
ENDI
IF NOT STRCMP S1(0) "+"
SOUN 200,100
GOTO BURDXIT
ENDI
FOPENO "PC2PC.REM" TEXT
IF FAILURE
GOSU Disc_Err
ENDI
LEGE "Waiting to receive new directory"
N1=1
N5=0
BURD100:
RGET S2 80 120
PRES S2
IF Failure
GOTO BURDXIT
ENDI
LENG S2 N3
IF GT N3 1
CRC S2(1:40) N2
ATOI S2(41:46) N4
IF NE N2 N4
TRAN "-!"
INC N5
IF GT N5,20
GOTO BURDXIT
ENDI
GOTO BURD100
ENDI
N5=0
ELSE
TRAN "+!"
GOTO BURDXIT
ENDI
IF GE (N99-5),N1
ATSA N1,41 (default) S2(1:37)
ELSE
IF EQ (N99-4) N1
FSAVEI
ENDI
LEGE S19(0:19)&" Line "*N1&" received"
ENDI
WRIT S2(1:40) 40
WRIT "^M" 2
INC N1
TRAN "+!"
GOTO BURD100
BURDXIT:
FCLOSEO
REWI
LEGE S19
RETU
Remote_C:
FCLOSEI
DELE "PC2PC.LOC"
CHDI S1
IF FLAG(2)
GOSU Change_s
ENDI
GOSU Clear_Wi
LEGE " Remote requested chdir"
GOSU BuildLoc
FOPENI "PC2PC.LOC" TEXT
IF FAILURE
GOSU Disc_Err
ENDI
N1=1
N5=0
RECH100:
READ S3 80 N2
PRES S3
S1=S3
IF EOF
S1="!"
GOTO RECH110
ENDI
CRC S1(0:39) N2
S1(40:50)=N2&"!"
RECH110:
TRAN "+"&S1
LEGE S19(0:19)&" Line "*N1&" sent"
RECH200:
RGET S2 80 60
PRES S2
IF Failure
GOTO RECHXIT
ENDI
IF NOT STRCMP S2(0:0) "+"
INC N5
IF GT N5,20
GOTO RECHXIT
ENDI
GOTO RECH110
ENDI
INC N1
N5=0
IF NOT EOF
GOTO RECH100
ENDI
RECHXIT:
REWI
LEGE S19
RETU
SendLocD:
CHDI S1
GOSU BuildLoc
TRAN "L!"
RGET S1 80 10
PRES S1
IF FAILURE
SOUN 100,100
GOTO SELDXIT
ENDI
IF NOT STRCMP S1(0) "+"
SOUN 200,100
GOTO SELDXIT
ENDI
FOPENI "PC2PC.LOC" TEXT
IF FAILURE
GOSU Disc_Err
ENDI
N1=1
SELD100:
READ S3 80 N2
PRES S3
S1=S3
IF EOF
S1="!"
GOTO SELD110
ENDI
CRC S1(0:39) N2
S1(40:50)=N2&"!"
SELD110:
TRAN "+"&S1
LEGE S19(0:19)&" Line "*N1&" sent"
SELD200:
RGET S2 80 60
PRES S2
IF Failure
GOTO SELDXIT
ENDI
IF NOT STRCMP S2(0:0) "+"
GOTO SELD110
ENDI
INC N1
IF NOT EOF
GOTO SELD100
ENDI
SELDXIT:
REWI
LEGE S19
RETU
Local_Ch:
FCLOSEI
DELE "PC2PC.REM"
IF NOT FLAG(2)
GOSU Change_s
ENDI
FOPENO "PC2PC.REM" TEXT
IF FAILURE
GOSU Disc_Err
ENDI
N1=1
LEGE "Remote is sending new listing"
GOSU Clear_Wi
LOCH100:
RGET S2 80 120
PRES S2
IF Failure
GOTO LOCHXIT
ENDI
LENG S2 N3
IF GT N3 1
CRC S2(1:40) N2
ATOI S2(41:46) N4
IF NE N2 N4
TRAN "-!"
GOTO LOCH100
ENDI
ELSE
TRAN "+!"
GOTO LOCHXIT
ENDI
IF GE (N99-5),N1
ATSA N1,41 (default) S2(1:37)
ELSE
IF EQ (N99-4) N1
FSAVEI
ENDI
LEGE S19(0:19)&" Line "*N1&" received"
ENDI
WRIT S2(1:40) 40
WRIT "^M" 2
INC N1
TRAN "+!"
GOTO LOCH100
LOCHXIT:
FCLOSEO
FOPENI "PC2PC.REM"
LEGE S19
RETU
Wildcard:
LEGE " Enter a wildcard spec for file(s) "
WOPE 10,1,12,77 (contrast) WILDEsc
ATSA 11,3 (contrast) "You may send or receive files: Enter S/R: "
ATSA 12,27 (contrast) " Press ESC to cancel "
WILD100:
ATGE 11,45 (contrast) 1 S1
IF NULL S1
GOTO WILDXIT
ENDI
SWIT S1
CASE "S"
SET FLAG(9) ON
ENDC
CASE "R"
SET FLAG(9) OFF
ENDC
DEFA
SOUN 100,100
GOTO WILD100
ENDC
ENDS
WILD200:
BOX 10,1,12,77 (contrast)
ATSA 11,3 (contrast) "Wildcard file spec: "
ATSA 12,27 (contrast) " Press ESC to cancel "
ATGE 11,24 (contrast) 50 S1
IF NULL S1
GOTO WILDXIT
ENDI
IF FLAG (9)
FFIR S1
IF FAILED
S1="No files match the given spec"
GOSU TranErr
GOTO WILD200
ENDI
TRAN "WR!"
ELSE
TRAN "WS"&S1&"!"
ENDI
WILD300:
RGET S2 80 10
IF FAILURE
S1="Remote has failed to acknowlege"
GOSU TranErr
GOTO WILDXIT
ENDI
IF NOT STRCMP S2(0) "+"
IF FLAG(9)
GOTO WILD300
ELSE
S1="Sender reports no files matching your spec"
GOSU TranErr
ENDI
GOTO WILDXIT
ENDI
IF FLAG(9)
SEND ZMODEM S1
ELSE
GETF ZMODEM
ENDI
IF FAILED
S1="Transfer has failed"
GOSU TranErr
ENDI
WILDXIT:
WCLO
LEGE S19
RETU
WILDEsc:
S1=""
RETU
TranErr:
S11="_ONESCAPE"
ON ESCA GOSU TranEsc
SAVE 10,1,12,77
BOX 10,1,12,77 (contrast)
ATSA 11,3 (contrast) S1
ATSA 12,26 (contrast) " Press any key to continue "
SOUN 880,100
KEYG S0
ON ESCA GOSU S11
REST
RETU
TranEsc:
RETU
Rcv_Wild:
IF STRCMP S1(0) "S"
FFIR S1(1:79)
IF FAILED
TRAN "-!"
RETU
ENDI
ENDI
TRAN "+!"
IF STRCMP S1(0) "R"
GETF ZMODEM
ELSE
SEND ZMODEM S1(1:79)
ENDI
IF FAILED
SOUN 880,500
ENDI
RETU
Select:
IF FLAG(2)
N10=N92
ELSE
N10=N91
ENDI
S10="_ONESCAPE"
ON ESCA GOSU SELEEsc
LEGE " Transfer selections"
SAVE 8,10,20,70
GOSU Read_Cur
SELE100:
BOX 8,10,20,70 (contrast)
ATSA 9,12 (contrast) " Local files selected Remote files selected"
ATSA 11,12 (contrast) "1) "*S16(0:12)
ATSA 12,12 (contrast) "2) "*S16(13:25)
ATSA 13,12 (contrast) "3) "*S16(26:38)
ATSA 14,12 (contrast) "4) "*S16(39:51)
ATSA 15,12 (contrast) "5) "*S16(52:64)
ATSA 11,40 (contrast) "a) "*S15(0:12)
ATSA 12,40 (contrast) "b) "*S15(13:25)
ATSA 13,40 (contrast) "c) "*S15(26:38)
ATSA 14,40 (contrast) "d) "*S15(39:51)
ATSA 15,40 (contrast) "e) "*S15(52:64)
IF LT N10 5 OR NULL S12
ATSA 17,12 (contrast) "Current cursor points to: "*S12(0:12)
ATSA 18,12 (contrast) "Do you wish to add this file (Y/N)?"
ELSE
ATSA 17,12 (contrast) "No more files may be selected from this side"
ATSA 18,12 (contrast) "Enter a letter or number from above to clear an entry"
ENDI
ATSA 19,12 (Contrast) "Select: "
ATSA 20,28 (Contrast) " Press ESC to exit "
SELE200:
LOCA 19,20
KEYG S1
SWIT S1
CASE "_NULL"
GOTO SELEXIT
ENDC
CASE "Y"
GOTO SELE500
ENDC
CASE "N"
GOTO SELEXIT
ENDC
CASE "1"
S16(0:79)=S16(13:79)
GOTO SELE300
ENDC
CASE "2"
S16(13:79)=S16(26:79)
GOTO SELE300
ENDC
CASE "3"
S16(26:79)=S16(39:79)
GOTO SELE300
ENDC
CASE "4"
S16(39:79)=S16(52:79)
GOTO SELE300
ENDC
CASE "5"
S16(52:79)=S16(65:79)
GOTO SELE300
ENDC
CASE "A"
S15(0:79)=S15(13:79)
GOTO SELE400
ENDC
CASE "B"
S15(13:79)=S15(26:79)
GOTO SELE400
ENDC
CASE "C"
S15(26:79)=S15(39:79)
GOTO SELE400
ENDC
CASE "D"
S15(39:79)=S15(52:79)
GOTO SELE400
ENDC
CASE "E"
S15(52:79)=S15(65:79)
GOTO SELE400
ENDC
DEFA
SOUN 100,100
GOTO SELE200
ENDC
ENDS
SELE300:
IF NOT ZERO N10
DEC N91
DEC N10
ENDI
GOTO SELE100
SELE400:
IF NOT ZERO N10
DEC N92
DEC N10
ENDI
GOTO SELE100
SELE500:
IF LT N10 5
IF FLAG(2)
S15(N10*13:79)=S12(0:12)
INC N10
INC N92
ELSE
S16(N10*13:79)=S12(0:12)
INC N10
INC N91
ENDI
ELSE
SOUN 100,100
GOTO SELE200
ENDI
SELEXIT:
ON ESCA GOSU S10
REST
RETU
SELEESC:
S1=""
RETU
Transfer:
IF ZERO N91 and ZERO N92
S1="You have not selected a file to transfer"
GOSU TranErr
RETU
ENDI
WOPE 10,1 12,77 (contrast)
ATSA 11,3 (contrast) "Transfer in progress"
TRAN100:
IF ZERO N91
GOTO TRAN200
ENDI
TRAN "TR"&S16(0:12)&"!"
TRAN110:
RGET S2 80 10
IF FAILURE
S1="Remote has failed to acknowlege"
GOSU TranErr
GOTO TRAN300
ENDI
IF NOT STRCMP S2(0) "+"
GOTO TRAN110
ENDI
SEND ZMODEM S16(0:12)
IF FAILED
S1="Transfer has failed"
GOSU TranErr
GOTO TRAN300
ENDI
S16(0:79)=S16(13:79)
DEC N91
GOTO TRAN100
TRAN200:
IF ZERO N92
GOTO TRAN300
ENDI
TRAN "TS"&S15(0:12)&"!"
TRAN210:
RGET S2 80 10
IF FAILURE
S1="Remote has failed to acknowlege"
GOSU TranErr
GOTO TRAN300
ENDI
IF NOT STRCMP S2(0) "+"
GOTO TRAN210
ENDI
DELE S15(0:12)
GETF ZMODEM
IF FAILED
S1="Transfer has failed"
GOSU TranErr
GOTO TRAN300
ENDI
S15(0:79)=S15(13:79)
DEC N92
GOTO TRAN200
TRAN300:
WCLO
TRANXIT:
RETU
Rcv_Tran:
TRAN "+!"
IF STRCMP S1(0) "R"
DELE S1(1:13)
GETF ZMODEM
ELSE
SEND ZMODEM S1(1:13)
ENDI
IF FAILED
SOUN 880,500
ENDI
RETU
InitScre:
SSIZ N99
SAVE 0,0,N99-2,79
BOX 0,0,(N99-2),78 (default)
ATSA 0,18 (default) " Local "
ATSA 0,35 (default) " PC-2-PC "
ATSA 0,56 (default) " Remote "
FOR N19=1 (N99-5) 1
ATSA N19 39 (default) "│"
ENDF
ATSA N99-4,0 (default) "├─────────────────────────────────────────────────────────────────────────────┤"
ATSA N99-4,39 (default) "┴"
ATSA N99-4,9 (default) " , , PgUp, PgDn "
ATSA N99-4,48 (default) " to this window "
ATSA N99-3,2 (Default) "H)elp, E)xit, C)hdir, W)ildcard, S)elect, T)ransfer and Alt-F10:"
ATSA N99-2,28 (Default) " Press ESC to terminate "
RETU
Help:
SAVE 0,0,24,78
BOX 0,0,24,78 (default)
ATSA 0,2 (Default) " PC-2-PC "
ATSA 24,28 (Default) " Press any key to continue "
S10="_ONESCAPE"
ON ESCA GOSU HELPESC
IF FLAG(0)
GOTO HELP100
ENDI
ATSA 1,2 (default) "PC-2-PC is a COM-AND script for linking PCs and exchanging files. When "
ATSA 2,2 (default) "PC-2-PC executed, it reads and displays the current subdirectory, and then "
ATSA 3,2 (default) "prompts for a method to establish a link."
ATSA 5,2 (default) "Two link methods are provided, either DIRECT connect, or CALLing through "
ATSA 6,2 (default) "the dialing directory. Each method has two sides: one that initiates the "
ATSA 7,2 (default) "connection, and one that awaits a connection. The first script loaded (or "
ATSA 8,2 (default) "the first PC to be loaded) is best instructed to 'await'. The second to "
ATSA 9,2 (default) "be loaded may then initiate the connection."
ATSA 11,2 (default) "A direct connection is, for example, an RS232 cable between async ports "
ATSA 12,2 (default) "of two PCs. The RS232 cable must be configured as a 'null modem' - i.e., "
ATSA 13,2 (default) "the send side of one PC must connect to the receive side of the other and "
ATSA 14,2 (default) "vice versa. As PC-2-PC ignores carrier using this method, even 3-wire "
ATSA 15,2 (default) "null modem will work."
ATSA 17,2 (default) "A called connection uses a modem on each PC, and the dialing directory "
ATSA 18,2 (default) "on one of them. The modems must be able to communicate ordinarily (not "
ATSA 19,2 (default) "all do). The initiator of the called connection selects the dialing "
ATSA 20,2 (default) "directory entry number (with or without LD prefix), and COM-AND dials "
ATSA 21,2 (default) "in the ordinary fashion. The PC awaiting the connect answers the call. "
ATSA 23,2 (default) "Once connection has been established, the PC's exchange directory lists. "
GOTO HELPXIT
HELP100:
ATSA 1,2 (default) "The two PC's are connected, and directory listings have been exchanged. "
ATSA 2,2 (default) "The left window is the current subdirectory on this PC. The right window "
ATSA 3,2 (default) "is the current directory on the remote. Cursor-keys (left/right) change "
ATSA 4,2 (default) "the 'active' window - you are either in the left or right windows."
ATSA 5,2 (default) "The 'C'hdir command will select a new drive:subdirectory on this PC (if "
ATSA 6,2 (default) "the left window is active), and on the remote PC (if right window). "
ATSA 7,2 (default) "The active window on the remote PC is switched (if need be) and a new "
ATSA 8,2 (default) "list is displayed on both PC's."
ATSA 10,2 (default) "PgUp, PgDn, Home and End allow paging through the active window for files. "
ATSA 11,2 (default) "Only paging is performed - the window is not scrolled line by line."
ATSA 13,2 (default) "Cursor-Up and Cursor-Down highlight files on the current page. A lighted "
ATSA 14,2 (default) "line is selected for transfer with 'S'elect. Up to 5 files on the local "
ATSA 15,2 (default) "side, and 5 files on the remote side may be selected. A 'T'ransfer may be "
ATSA 16,2 (default) "done at any time to transfer files (either from or to the local PC). "
ATSA 17,2 (default) "A wildcard file transfer is also available, selecting files to/from other "
ATSA 18,2 (default) "than the current subdirectory, or where a template might make life easier. "
ATSA 19,2 (default) "Unlike the 'T'ransfer command, you transfer using a wildcard only one "
ATSA 20,2 (default) "direction at a time, either sending or receiving. "
ATSA 22,2 (default) "If you have selected files, you must transfer them before changing sub- "
ATSA 23,2 (default) "directories. E)xit terminates both sides if a called connected was made."
GOTO HELPXIT
HELPXIT:
KEYG S0
ON ESCA GOSU S10
REST
RETU
HELPESC:
RETU